<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta charset="utf-8"/>
    <title>${systemName!} - 登录</title>
    <link rel="shortcut icon" type="image/x-icon" media="screen" href="${rc.contextPath}/favicon.ico">
    <link rel="stylesheet" href="${rc.contextPath}/statics/assets/libs/layui/css/layui.css?v=2.4.3"/>
    <link rel="stylesheet" href="${rc.contextPath}/statics/assets/css/login.css" media="all">
    <style type="text/css">
    	body {
		    background-image: url(${loginPagePicUrl!});
		}
    </style>
</head>

<body>
<div class="login-wrapper">

    <div class="login-header">
        <img src="${rc.contextPath}/statics/assets/images/logo.png"> ${systemName!}
    </div>

    <div class=" login-body">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;登录
            </div>
            <div class="layui-card-body layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
                    <div class="layui-input-block">
                        <input name="username" type="text" lay-verify="required" placeholder="账号" class="layui-input" autocomplete="off">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
                    <div class="layui-input-block">
                        <input name="password" type="password" lay-verify="required" placeholder="密码" class="layui-input" autocomplete="off">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
                    <div class="layui-input-block">
                        <div class="layui-row inline-block">
                            <div class="layui-col-xs7">
                                <input name="code" type="text" lay-verify="required" placeholder="验证码" class="layui-input" autocomplete="off">
                            </div>
                            <div class="layui-col-xs5" style="padding-left: 10px;">
                                <img class="login-captcha" src="${rc.contextPath}/captcha/image">
                            </div>
                        </div>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <a href="javascript:;" class="layui-link pull-right">忘记密码？</a>
                </div> -->
                <div class="layui-form-item">
                    <button lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
                </div>
                <!-- <div class="layui-form-item login-other">
                    <label>第三方登录</label>
                    <a href="javascript:layer.msg('暂未开放');"><i class="layui-icon layui-icon-login-qq"></i></a>
                    <a href="javascript:layer.msg('暂未开放');"><i class="layui-icon layui-icon-login-wechat"></i></a>
                    <a href="javascript:layer.msg('暂未开放');"><i class="layui-icon layui-icon-login-weibo"></i></a>
                </div> -->
            </div>
        </div>
    </div>
    
    <div class="login-footer"><p>${systemCopyRight!}</p></div>
</div>

<script type="text/javascript" src="${rc.contextPath}/statics/assets/libs/layui/layui.js?v=2.4.3"></script>
<script>
    layui.config({
        base: '${rc.contextPath}/statics/module/'
    }).use(['form'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        // 表单提交
        form.on('submit(login-submit)', function (obj) {
            layer.load(2);
            $.ajax({
                url: '${rc.contextPath}/user/login',
                data: obj.field,
                type: 'GET',
                dataType: 'JSON',
                success: function (data) {
                    layer.closeAll();
                    if(data.success) {
                    	location.replace('${rc.contextPath}/index');
                    } else {
	                    layer.msg(data.message, {icon: 5});
                    }

                	var captcha = $('.login-captcha')[0];
                	captcha.src = captcha.src + '?t=' + (new Date).getTime();
                },
                error: function (xhr) {
                    layer.closeAll();
                    if (xhr.status != 200) {
                        layer.msg('登陆失败，请稍后重试', {icon: 5});
                    }
                }
            });
        });
        // 图形验证码
        $('.login-captcha').click(function () {
            this.src = this.src + '?t=' + (new Date).getTime();
        });
    });
</script>
</body>
</html>